package leetcode;

import common.*;

public class minimumdepthofbinarytree {
	public int run(BTNode root) {
		if (root == null) {
			return 0;
		}
		if (root.left == null) {
			return run(root.right) + 1;
		} else if (root.right == null) {
			return run(root.left) + 1;
		} else {
			int left = run(root.left);
			int right = run(root.right);
			return 1 + Math.min(left, right);
		}

	}
}
